package com.wxn.learncompose.pagers

import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Slider
import androidx.compose.material3.SliderDefaults
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.TextUnitType
import androidx.compose.ui.unit.dp

@Composable fun SliderPager() {
    var progress by remember {
        mutableStateOf(0.5f)
    }

    Surface {
        Column(
            modifier = Modifier
                .padding(0.dp)
                .fillMaxSize(),
            verticalArrangement = Arrangement.Center,
            horizontalAlignment = Alignment.CenterHorizontally
        ) {

            Slider(value = progress,
                onValueChange = {
                    progress = it
                },
                colors = SliderDefaults.colors(
                    thumbColor = Color.White,
                    activeTickColor = Color(0XFF33EE99)
                )
            )
            Text(text = "$progress",
                modifier = Modifier.padding(0.dp).width(120.dp),
                fontWeight = FontWeight.Normal,
                color = Color(0XFF335533),
                fontSize = TextUnit(16f, TextUnitType.Sp)
            )

        }
    }

}